<%--                                                                       --%>
<%-- Copyright (c) 2004 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>


<%@ page import =  "java.util.HashMap,
                    org.apache.commons.beanutils.PropertyUtils,
                    org.apache.struts.validator.DynaValidatorForm"
%>

<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>


<script language="JavaScript">
  function doUserRoleEditAction(theForm) {
      theForm.action = '<html-el:rewrite page="/mt/userRoleEdit.do"/>';
      theForm.submit();
      return true;
  }
</script>

<%
  java.util.HashMap map = new java.util.HashMap();
  DynaValidatorForm mtUserRoleForm = (DynaValidatorForm) request.getAttribute("mtUserRoleForm");
  map.put("userId", (Long) PropertyUtils.getSimpleProperty(mtUserRoleForm, "userId"));
  pageContext.setAttribute("pagetabParam", map, PageContext.PAGE_SCOPE);
%>

<html-el:form action="/mt/userRoleEdit.do">

<html-el:hidden name="mtUserRoleForm" property="userId"/>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">

      <div class="pageTitle">
            <bean-el:message key="mt.user.view.page.title" bundle="mt.messages"/>:
            <c:out value="${mtUserRoleView.map.formattedName}"/>
      </div> 

      <div class="errorMessage"><html-el:errors bundle="mt.messages" /></div>
      <%@include file="/mc/common/pagetab.jsp" %>

      <div class="pageSubtitle">
        <span class="left">
          <bean-el:message key="mt.user.role.selectedRoles" bundle="mt.messages"/>
        </span>

        <span class="right">
          <html-el:submit styleClass="inputButton" property="editBtn"  onclick="return doUserRoleEditAction(this.form)">
            <bean-el:message key="button.edit" bundle="mt.messages"/>
          </html-el:submit>
        </span>
      </div>

      <!--start main content area here-->
      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Category" width="100%">
        <tr class="listHeader"> 
          <th id="SubCategoryName" align="left" width="25%">
            <bean-el:message key="mt.user.role" bundle="mt.messages"/>
          </th>
          <th id="SubCategoryName" align="left" width="50%">
            <bean-el:message key="mt.user.role.description" bundle="mt.messages"/>
          </th>
        </tr>

        <c:choose>
          <c:when test="${not empty mtUserRoleView.map.roleList}">
            <c:forEach var="oneRole" items="${mtUserRoleView.map.roleList}" varStatus="status">

              <c:choose>
                <c:when test="${(status.count + 1) % 2 == 0}">
	<tr class="listEven">
                </c:when> 
  	        <c:otherwise>
	<tr class="listOdd">
	        </c:otherwise>
              </c:choose>

          <td headers="SubCategoryName">
            <c:out value="${oneRole.map.name}" />
          </td>
          <td headers="SubCategoryName">
            <c:out value="${oneRole.map.description}" />
          </td>
        </tr>      
        
            </c:forEach>
          </c:when>
          <c:otherwise>
              <tr class="listOdd">
                <td colspan=7 align="center">
                  <bean-el:message key="mt.user.role.noRole" bundle="mt.messages"/>
                </td>
              </tr>
          </c:otherwise>
        </c:choose>
      </table>
      <!--end main content area here-->
    </td>
  </tr>
</table>

</html-el:form>